/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.aacorps.javaeal;

import edu.aacorps.javaeal.remote.UserServiceRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

/**
 *
 * @author anti
 */
public class Main {
    
    private UserServiceRemote userSession = lookupUserSessionRemote();
    
    public static void main(String[] args) {
        Main m = new Main();
//        m.getUserSession().registerUser();
    }

    private UserServiceRemote lookupUserSessionRemote() {
        try {
            Context c = new InitialContext();
            return (UserServiceRemote) c.lookup("java:global/edu.aacorps.javaeal_JavaEAL-ear_ear_1.0-SNAPSHOT/edu.aacorps.javaeal_JavaEAL-ejb_ejb_1.0-SNAPSHOT/UserSession!edu.aacorp.UserSessionRemote");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }

    /**
     * @return the userSession
     */
    public UserServiceRemote getUserSession() {
        return userSession;
    }

    /**
     * @param userSession the userSession to set
     */
    public void setUserSession(UserServiceRemote userSession) {
        this.userSession = userSession;
    }
}
